window.onload = setPreURL;

function setPreURL(){
	var ourl = document.location.href;
	SetCookie('PreURL',ourl);
}

function SetCookie(name, value){
        var argv        = SetCookie.arguments;
        var argc        = SetCookie.arguments.length;
        var expires     = (argc > 2) ? argv[2] : null;
        var path        = (argc > 3) ? argv[3] : null;
        var domain      = (argc > 4) ? argv[4] : null;
        var secure      = (argc > 5) ? argv[5] : false;
		//alert(name+";"+escape(value)+";"+expires+";"+path+";"+domain+";"+secure);
        
                

        document.cookie = name + "=" + escape(value)
                + ((expires     == null) ? "" : ("; expires="   + expires))
                + ((path        == null) ? ";path=/" : ("; path="    + escape(path)));
                + ((domain      == null) ? "" : ("; domain="  + escape(domain)))
                + ((secure      == true) ? "; secure" : "");
		
//		alert(document.cookie);

}